package org.molamil.acto.expressions{
	import flash.utils.getDefinitionByName;
	import flash.errors.IllegalOperationError;
	import flash.utils.getQualifiedClassName;

	/**
	 * @author martindyrby
	 */
	public class AbstractExpressionEvaluator implements PrioritzableEvaluator{


		// CONSTANTS
		
		/**
		 * Represents the default <code>priority</code> for this class. This value is set
		 * to the <code>priority</code> property at construction time.
		 */
		public static const PRIORITY:uint = 0;
		
		// PROPERTIES
		
		protected var _priority:uint;
		
		
		
		public function AbstractExpressionEvaluator() {
			var className:String = getQualifiedClassName(this);
			
			// Throw an error if instanciating this class, and not subclasses.
			if(className == "org.molamil.acto.expressions::AbstractExpressionResolver")
            	throw new IllegalOperationError("AbstractExpressionResolver must be extended");
            
            // Check the subclasses' constants to initialize priority.
			_priority = getDefinitionByName(className)["PRIORITY"];
		}


		public function evaluate(input:String,data:Object):*{
		}






		// GETTER/SETTER
		
		public function get priority():uint{
			return _priority;
		}

		public function set priority(priority:uint):void{
			_priority = priority;
		}
	}
}
